<div id="windowmask" class="windowmask" style="display: none;z-index: 200;"></div>
<div class="container">
    <?php
    include 'member-left.php';
    $arrNotFriend = $member->getFriendInGroup();
    $num_records = $db->NumRows($arrNotFriend);
    ?>
    <div class="col_r">
        <div class='friend_container'>
            <div class="header_link">
                <ul class="left">
                    <li class="actived" style="width: 150px"><a href="#">Danh sách bạn bè (<b id="num_rows" ><?php echo $num_records; ?></b>)</a></li>
                    <li class="search">
                        <span class="left"></span><input class="inputtext" type="text" id="txtkey_friend" value="Nhập tên một người bạn" title="Nhập tên một người bạn"><span class="right"></span>
                        <div class="reset"></div>
                    </li>

                    <li class="end"></li>

                </ul>

            </div>
            <div id="MySplitter">
                <div class="sidebar" id="divrecyclebin">
                    <div id="recyclebin_g" class="friend_group_box">Xóa khỏi nhóm</div>
                    <div id='recyclebin' class="friend_group_box">Thôi là bạn</div>              
                </div>
                <div class="block_friend" id="friend_drag">

                    <ul class="friend_list">
                        <?php
                        $rsGroup = $member->getAllGroup();
                        $arrGroup = array();
                        while ($row = $db->FetchToArray($rsGroup)) {
                            $arrGroup[$row['id']] = $row;
                        }

                        while ($row = $db->FetchToArray($arrNotFriend)) {
                            $arrBelongGroup = explode(",", $row['groups']);
                            ?>

                            <li >
                                <div class="friend_box drag" title="<?php echo $row['fullname']; ?>" id="<?php echo $row['id']; ?>" rel="<?php echo $row['groups']; ?>">
                                    <img src="<?php echo $common->get_avatar_thumb($row['avatar']); ?>">

                                </div>
                                <h4><a href="<?php echo DOMAIN . "/thanh-vien?mid=" . $row['id']; ?>"><?php echo $row['fullname']; ?></a></h4>
                                <span><?php echo $row['email']; ?></span>
                                <div class="sys_action">
                                    <div class="sys_act_icon"></div>  
                                </div>
                                <div class="box_action">
                                    <div class="overlap"></div>
                                    <ul rel="<?php echo $row['id']; ?>" lang="<?php echo $row['groups']; ?>">
                                        <?php
                                        foreach ($arrGroup as $value) {
                                            ?>
                                            <li>
                                                <input type="checkbox" <?php if(in_array($value['id'], $arrBelongGroup)) echo "checked"; ?> id="<?php echo $value['id']; ?>"/> <?php echo $value['group_name']; ?>
                                            </li>
                                        <?php } ?>
                                        <li class="sep"></li>                                       
                                        <li class="rm"><div>Thôi không là bạn</div></li>
                                    </ul>
                                </div>
                            </li>
                        <?php } ?>
                    </ul>
                    <img src="/images/loading_small.gif" style="display:none;margin-left: 265px" id="fri_loading" >
                    <input type="hidden" class="items_selected" id="number_selected"></input>

                </div>

                <div class="friendgroup_container sidebar" >
                    <ul class="friendgroup_list">

                        <?php
                        foreach ($arrGroup as $value) {
                            ?>
                            <li >
                                <div class="circle">
                                    <div class="friend_group_box" id="<?php echo $value['id']; ?>" title="<?php echo $value['desc']; ?>">
                                        <div class="content" >
                                            <span><b><?php echo $value['group_name']; ?></b></br> (<b class="number"><?php echo $value['length']; ?></b> người)</span>
                                        </div>
                                    </div>
                                </div>

                            </li>
                        <?php } ?>
                        <li >
                            <div class="circle">
                                <div class="add" >

                                    <div class="content" >
                                        <a href="javascript:void();" onclick="showCreateGroup();">Thêm nhóm </a>

                                    </div>

                                </div>
                            </div>
                        </li>

                    </ul>
                    <input type="hidden" value="" id="group_selected"></input>
                </div>
            </div>
            <div id="createGroup">
                <div  class="title_mb_bg2 create_group">

                    <ul>

                        <li>
                            <div class="col_l">Tên nhóm</div>
                            <div class="col_r"><input type="text" value="" id="i_name" class="inputtext"></div>
                        </li>
                        <li class="end">
                            <div class="col_l">Mô tả thêm</div>
                            <div class="col_r"><textarea id="i_desc" rows="4" class="inputtext"></textarea></div>
                        </li>

                    </ul>
                    <div class="button_bottom">
                        <div class="btn-left-02"><input type="button" onclick="CreateGroup();" id="btncreateGroup" name="btncreateGroup" value="Tạo nhóm" class="btnBlogComment left"></div>
                        <div class="btn-left-07"><input type="button" onclick="Lightbox.hide();" value="Hủy bỏ" class="left button"></div>
                        <img class="loading" style="display:none" src="/images/loading_small.gif">
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                    <div id="message_alert_content" class="error"></div>
                </div>
            </div>
        </div>


    </div>

    <script src="/js/friends.js" type="text/javascript"></script>

</div>
